package cn.hdu.liang.typeinfo;


public class Exam8 {

    public static void main(String args[]) throws Exception {
        System.out.println("Displaying java.util.ArrayList");
        printClasses(Class.forName("java.util.ArrayList"));
    }

    static void printClasses(Class<?> c) {
        // getSuperclass() returns null on Object:
        if(c == null) return;
        System.out.println(c.getName());
        // Produces the interfaces that this class
        // implements:
        for(Class<?> k : c.getInterfaces()) {
            System.out.println("Interface: " + k.getName());
            printClasses(k.getSuperclass());
        }
        printClasses(c.getSuperclass());
    }
}
